package org.bunny.vehicle.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * 班次
 * 
 * @author Bunny
 * @version 2013-5-16 下午4:01:17
 * 
 */
@Entity
public class Journey implements Serializable, Cloneable {

	private static final long serialVersionUID = 660124127955558071L;

	/**
	 * 班次ID
	 */
	@Id
	@GeneratedValue
	private int id;

	/**
	 * 时间
	 */
	private String journeyTime;

	/**
	 * 路线
	 */
	private String route;

	/**
	 * 车辆
	 */
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH })
	@JoinColumn(name = "vehicle", referencedColumnName = "id")
	private Vehicle vehicle;

	/**
	 * 司机
	 */
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH })
	@JoinColumn(name = "driver", referencedColumnName = "id")
	private User driver;

	/**
	 * 备注说明
	 */
	private String remark;

	/**
	 * 申请者
	 */
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH })
	@JoinColumn(name = "commitUser", referencedColumnName = "id")
	private User commitUser;

	/**
	 * 提交时间
	 */
	@Temporal(TemporalType.DATE)
	private Date commitDate;

	/**
	 * 审核者
	 */
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH })
	@JoinColumn(name = "verifyUser", referencedColumnName = "id")
	private User verifyUser;

	/**
	 * 审核时间
	 */
	@Temporal(TemporalType.DATE)
	private Date verifyDate;

	/**
	 * 审核状态
	 */
	private byte verifyStatus;

	/**
	 * 未审核
	 */
	public static final byte VERIFY_UNVERIFYED = 0;

	/**
	 * 未通过审核
	 */
	public static final byte VERIFY_UNPASSED = 1;

	/**
	 * 已通过审核
	 */
	public static final byte VERIFY_PASSED = 2;

	/**
	 * 已不可用
	 */
	public static final byte VERIFY_UNAVAILABLE = 3;

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (id ^ (id >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof Journey)) {
			return false;
		}
		Journey other = (Journey) obj;
		if (id != other.id)
			return false;
		return true;
	}

	/**
	 * @return id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @param id
	 *            要设置的 id
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * @return journeyTime
	 */
	public String getJourneyTime() {
		return journeyTime;
	}

	/**
	 * @param journeyTime
	 *            要设置的 journeyTime
	 */
	public void setJourneyTime(String journeyTime) {
		this.journeyTime = journeyTime;
	}

	/**
	 * @return route
	 */
	public String getRoute() {
		return route;
	}

	/**
	 * @param route
	 *            要设置的 route
	 */
	public void setRoute(String route) {
		this.route = route;
	}

	/**
	 * @return vehicle
	 */
	public Vehicle getVehicle() {
		return vehicle;
	}

	/**
	 * @param vehicle
	 *            要设置的 vehicle
	 */
	public void setVehicle(Vehicle vehicle) {
		this.vehicle = vehicle;
	}

	/**
	 * @return driver
	 */
	public User getDriver() {
		return driver;
	}

	/**
	 * @param driver
	 *            要设置的 driver
	 */
	public void setDriver(User driver) {
		this.driver = driver;
	}

	/**
	 * @return remark
	 */
	public String getRemark() {
		return remark;
	}

	/**
	 * @param remark
	 *            要设置的 remark
	 */
	public void setRemark(String remark) {
		this.remark = remark;
	}

	/**
	 * @return commitUser
	 */
	public User getCommitUser() {
		return commitUser;
	}

	/**
	 * @param commitUser
	 *            要设置的 commitUser
	 */
	public void setCommitUser(User commitUser) {
		this.commitUser = commitUser;
	}

	/**
	 * @return commitDate
	 */
	public Date getCommitDate() {
		return commitDate;
	}

	/**
	 * @param commitDate
	 *            要设置的 commitDate
	 */
	public void setCommitDate(Date commitDate) {
		this.commitDate = commitDate;
	}

	/**
	 * @return verifyUser
	 */
	public User getVerifyUser() {
		return verifyUser;
	}

	/**
	 * @param verifyUser
	 *            要设置的 verifyUser
	 */
	public void setVerifyUser(User verifyUser) {
		this.verifyUser = verifyUser;
	}

	/**
	 * @return verifyDate
	 */
	public Date getVerifyDate() {
		return verifyDate;
	}

	/**
	 * @param verifyDate
	 *            要设置的 verifyDate
	 */
	public void setVerifyDate(Date verifyDate) {
		this.verifyDate = verifyDate;
	}

	/**
	 * @return verifyStatus
	 */
	public byte getVerifyStatus() {
		return verifyStatus;
	}

	/**
	 * @param verifyStatus
	 *            要设置的 verifyStatus
	 */
	public void setVerifyStatus(byte verifyStatus) {
		this.verifyStatus = verifyStatus;
	}

}
